<?php

namespace App\Model\Backend;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Crypt;

class Member extends Model
{
    protected $table = 'member';
    public $timestamps = false;
    protected $primaryKey = 'uid';
    // protected $redirectAfterLogout = '/';
    public function checkLogin($username,$password)
    {
        $Member = $this->where(['username' => $username])->first();
        if ($Member) {
            if (Crypt::decrypt($Member['password']) != $password) {
                return false;
            }

            //session()->put('member', 123);
            session()->put('member', $Member);
            return true;
        }
    }

}
